package com.tengju.bff.interfaces.covercharge.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tengju.bff.interfaces.covercharge.entity.dto.CycleAddInfo;
import com.tengju.bff.interfaces.covercharge.entity.po.ServiceWithdarwCycleAdd;
import com.tengju.bff.interfaces.covercharge.entity.vo.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 服务费体现周期累计表 服务类
 * </p>
 *
 * @author zhaoyi
 * @since 2020-02-24
 */
public interface IServiceWithdarwCycleAddService extends IService<ServiceWithdarwCycleAdd> {
    /**
     * 注册个体户,个人提现申请批量/单笔打款校验
     * @param cycleAddId 周期id
     * @return payMoneyResult
     */
    PayMoneyResult onlinePayMoneyCheck(Integer cycleAddId);

    /**
     * 注册个体户,个人提现申请全量打款前置校验
     * @param startDateStr 开始时间
     * @param endDateStr 结束时间
     * @return payMoneyResult
     */
    PayMoneyResult onlineFullPayMoneyCheck(String startDateStr, String endDateStr);

    /**
     * 批量打款处理
     */
    PayMoneyResult dealOnlinePayMoney(CycleAddInfo cycleAddInfo);


    /**
     * 注册个体户,个人提现申请全量后置打款校验
     * @param cycleAddId 周期id
     * @return payMoneyResult
     */
    PayMoneyResult onlineAllPayMoneyCheck(Integer cycleAddId);

    /**
     * 获取所有代理服务费周期提现总金额
     * @param serviceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO
     * @return vo
     */
    ServiceWithdarwCycleAddVO getAllTotal(ServiceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO);

    /**
     * 更新任务
     * @param taskNo 任务标识
     * @param status 状态
     * @param successSize 成功数
     * @param failSize 失败数
     * @return null
     * **/
    void updateCycleCheckTask(String taskNo,Integer status,Integer successSize,Integer failSize);

    /**
     * 获取总数
     * @param serviceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO
     * @return vo
     */
    Integer sumTotal(ServiceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO);

    /**
     * 周期打款校验
     * @param allSize 总数
     * @param taskSey 任务标识
     * @param approvers 操作人
     * @return vo
     */
    CycleAddCheckTaskResult cycleAddCheckCreateTask(int allSize, String taskSey, String approvers);

    /**
     * 服务费提现金额异常数据列表
     * @param serviceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO
     * @return page
     */
    IPage<ServiceWithdarwCycleAddVO> checkErrorPage(ServiceWithdarwCycleAddQueryVO serviceWithdarwCycleAddQueryVO);

    /**
     * 生成交易单
     * @param cycleAddId 周期id
     * @param approvers 打款人
     *
     * */
   void createCycleAddTransOrder(Integer cycleAddId,String approvers);

    /**
     * 周期打款MQ处理
     * @param cycleAddInfo 周期数据
     * @return void
     * */
    //void sendOnlinePayMoneyMessage(CycleAddInfo cycleAddInfo);

    /**
     * 周期打款，MQ消费处理
     * @param deliveryTag
     * @param channel
     * @param message
     * @return
     */
    //void dealOnlinePayMoneyMessage(Long deliveryTag, Channel channel, RabbitMqMessage message) throws Exception;

    /**
     * 获取周期列表
     * @param startDateStr 周期开始时间
     * @param endDateStr 周期结束时间
     * @return list
     * */
    List<ServiceWithdarwCycleAdd> queryCycleAddList(String startDateStr, String endDateStr);

    /**
     * 获取周期提交参数
     * @param cycleAddId 周期id
     * @param approvers 打款人
     * @return CycleAddInfo
     * */
    CycleAddInfo getCycleAddInfo(Integer cycleAddId,String approvers);

    /**
     * 释放缓存
     * @param cycleAddId 周期id
     * */
    void delRedisKey(Integer cycleAddId);

    BigDecimal getTotalAmountWithList(List<Integer> cycleAddIdList);
}
